import request from '@/utils/request'

// 查询广告列表
export function listAdv(query) {
  return request({
    url: '/app/adv/list',
    method: 'get',
    params: query
  })
}

// 查询广告详细
export function getAdv(advId) {
  return request({
    url: '/app/adv/' + advId,
    method: 'get'
  })
}

// 新增广告
export function addAdv(data) {
  return request({
    url: '/app/adv',
    method: 'post',
    data: data
  })
}

// 修改广告
export function updateAdv(data) {
  return request({
    url: '/app/adv',
    method: 'put',
    data: data
  })
}

// 删除广告
export function delAdv(advId) {
  return request({
    url: '/app/adv/' + advId,
    method: 'delete'
  })
}

// 导出广告
export function exportAdv(query) {
  return request({
    url: '/app/adv/export',
    method: 'get',
    params: query
  })
}

export function uploadToOss(body) {
  console.log(body)
  return request({
    url: "/common/uploadToOss",
    method: "post",
    body: body,
    headers: {
      contentType: 'multipart/form-data'
    }
  })
}
